import request from '@/utils/request';
import qs from 'qs';
import type { PageResult, ResponseData } from '../typing';
// 参数接口
export interface GetMedicalCaregiverInvoicePageParams {
    /*当前第几页(默认1) */
    current?: number;
    /*每页条数(默认20) */
    size?: number;
    /*订单编号 */
    orderNo?: string;
    /*发票号 */
    invoiceNo?: string;
    /*发票 */
    invoiceData?: Record<string, unknown>[];
    /*创建时间 */
    createTime?: Record<string, unknown>[];
    /* */
    page?: {
        /* */
        records?: {
            /* */
            createTime?: string;
            /* */
            updateTime?: string;
            /* */
            creator?: Record<string, unknown>;
            /* */
            updater?: Record<string, unknown>;
            /*订单编号 */
            orderNo?: string;
            /*订单时间 */
            orderTime?: string;
            /*订单金额 */
            orderAmount?: number;
            /*患者姓名 */
            patientName?: string;
            /*患者电话 */
            patientPhone?: string;
            /*发票号 */
            invoiceNo?: string;
            /*发票 */
            invoiceUrl?: string;
            /*发票上传时间 */
            invoiceTime?: string;
        }[];
        /* */
        total?: Record<string, unknown>;
        /* */
        size?: Record<string, unknown>;
        /* */
        current?: Record<string, unknown>;
        /* */
        orders?: {
            /* */
            column?: string;
            /* */
            asc?: boolean;
        }[];
        /* */
        optimizeCountSql?: boolean;
        /* */
        searchCount?: boolean;
        /* */
        optimizeJoinOfCountSql?: boolean;
        /* */
        maxLimit?: Record<string, unknown>;
        /* */
        countId?: string;
        /* */
        pages?: Record<string, unknown>;
    };
}
// 响应接口
export interface GetMedicalCaregiverInvoicePageRes {
    /* */
    code: number;
    /* */
    data: {
        /* */
        size: number;
        /* */
        total: number;
        /* */
        current: number;
        /* */
        records: {
            /* */
            createTime: Record<string, unknown>;
            /* */
            updateTime: Record<string, unknown>;
            /* */
            creator: number;
            /* */
            updater: number;
            /*订单编号 */
            orderNo: string;
            /*订单时间 */
            orderTime: Record<string, unknown>;
            /*订单金额 */
            orderAmount: number;
            /*患者姓名 */
            patientName: string;
            /*患者电话 */
            patientPhone: string;
            /*发票号 */
            invoiceNo: string;
            /*发票 */
            invoiceUrl: string;
            /*发票上传时间 */
            invoiceTime: Record<string, unknown>;
        }[];
        /* */
        pages: number;
    };
    /* */
    msg: string;
}
/**
 * 获得发票分页
 * @param {object} params 管理后台 - 发票管理分页 Request VO
 * @param {number} params.current 当前第几页(默认1)
 * @param {number} params.size 每页条数(默认20)
 * @param {string} params.orderNo 订单编号
 * @param {string} params.invoiceNo 发票号
 * @param {array} params.invoiceData 发票
 * @param {array} params.createTime 创建时间
 * @param {object} params.page
 * @returns
 */
export function getMedicalCaregiverInvoicePage(params: GetMedicalCaregiverInvoicePageParams): Promise<GetMedicalCaregiverInvoicePageRes> {
    return request.post(`/yfwy/medical-caregiver-invoice/page`, params);
}
/**
 * 导入发票(压缩包)
 * @param {string} file
 * @returns
 */
export function importMedicalCaregiverInvoice(file: object): Promise<ResponseData<any>> {
    return request.post(`/yfwy/medical-caregiver-invoice/import-invoice?file=${file}`, file, {
        headers: {
            'Content-type': 'multipart/form-data',
        },
    });
}
/**
 * 导入发票号
 * @param {string} file
 * @returns
 */
export function importMedicalCaregiverInvoiceNos(file: object): Promise<ResponseData<any>> {
    return request.post(`/yfwy/medical-caregiver-invoice/import-invoice-nos?file=${file}`, file, {
        headers: {
            'Content-type': 'multipart/form-data',
        },
    });
}
// 参数接口
export interface ExportMedicalCaregiverInvoiceExcelParams {
    /*当前第几页(默认1) */
    current?: number;
    /*每页条数(默认20) */
    size?: number;
    /*订单编号 */
    orderNo?: string;
    /*发票号 */
    invoiceNo?: string;
    /*发票 */
    invoiceData?: Record<string, unknown>[];
    /*创建时间 */
    createTime?: Record<string, unknown>[];
    /* */
    page?: {
        /* */
        records?: {
            /* */
            createTime?: string;
            /* */
            updateTime?: string;
            /* */
            creator?: Record<string, unknown>;
            /* */
            updater?: Record<string, unknown>;
            /*订单编号 */
            orderNo?: string;
            /*订单时间 */
            orderTime?: string;
            /*订单金额 */
            orderAmount?: number;
            /*患者姓名 */
            patientName?: string;
            /*患者电话 */
            patientPhone?: string;
            /*发票号 */
            invoiceNo?: string;
            /*发票 */
            invoiceUrl?: string;
            /*发票上传时间 */
            invoiceTime?: string;
        }[];
        /* */
        total?: Record<string, unknown>;
        /* */
        size?: Record<string, unknown>;
        /* */
        current?: Record<string, unknown>;
        /* */
        orders?: {
            /* */
            column?: string;
            /* */
            asc?: boolean;
        }[];
        /* */
        optimizeCountSql?: boolean;
        /* */
        searchCount?: boolean;
        /* */
        optimizeJoinOfCountSql?: boolean;
        /* */
        maxLimit?: Record<string, unknown>;
        /* */
        countId?: string;
        /* */
        pages?: Record<string, unknown>;
    };
}

/**
 * 导出发票 Excel
 * @param {object} params 管理后台 - 发票管理分页 Request VO
 * @param {number} params.current 当前第几页(默认1)
 * @param {number} params.size 每页条数(默认20)
 * @param {string} params.orderNo 订单编号
 * @param {string} params.invoiceNo 发票号
 * @param {array} params.invoiceData 发票
 * @param {array} params.createTime 创建时间
 * @param {object} params.page
 * @returns
 */
export function exportMedicalCaregiverInvoiceExcel(params: ExportMedicalCaregiverInvoiceExcelParams): Promise<Blob> {
    return request.post(`/yfwy/medical-caregiver-invoice/export-excel`, params, {
        responseType: 'blob',
    });
}
// 响应接口
export interface GetMedicalCaregiverInvoiceRes {
    /* */
    code: number;
    /* */
    data: {
        /* */
        createTime: Record<string, unknown>;
        /* */
        updateTime: Record<string, unknown>;
        /* */
        creator: number;
        /* */
        updater: number;
        /*订单编号 */
        orderNo: string;
        /*订单时间 */
        orderTime: Record<string, unknown>;
        /*订单金额 */
        orderAmount: number;
        /*患者姓名 */
        patientName: string;
        /*患者电话 */
        patientPhone: string;
        /*发票号 */
        invoiceNo: string;
        /*发票 */
        invoiceUrl: string;
        /*发票上传时间 */
        invoiceTime: Record<string, unknown>;
    };
    /* */
    msg: string;
}
/**
 * 获得发票管理
 * @param {string} id
 * @returns
 */
export function getMedicalCaregiverInvoice(id: number): Promise<GetMedicalCaregiverInvoiceRes> {
    return request.get(`/yfwy/medical-caregiver-invoice/${id}`);
}
/**
 * 删除发票
 * @param {string} id
 * @returns
 */
export function deleteMedicalCaregiverInvoice(id: number): Promise<ResponseData<any>> {
    return request.delete(`/yfwy/medical-caregiver-invoice/${id}`);
}
